<?php

define('MYSQL_RESULT_TYPE',1);
class wapControl extends Control{
	/*
	 * 构造方法
	 */
	public function __construct(){
		parent::__construct();
		
		/**
		 * 设置模板文件夹路径
		 */
		Tpl::setDir('wap');
		
		/**
		 * 设置布局文件内容
		*/
		Tpl::setLayout('wap_layout');
		
		$model = Model();
		$wxaccount = $model->table('wxaccount')->where(array('wx_id'=>'1'))->find();
		Tpl::output('site_theme',$wxaccount['site_theme']);
		Tpl::output('site_name',$wxaccount['site_name']);
		Tpl::output('site_tele',$wxaccount['site_tele']);
		Tpl::output('site_copyright',$wxaccount['site_copyright']);
		Tpl::output('tongji',$wxaccount['tongji']);
		
	}
		
	public function indexOp(){
		$this->homeOp();
	}
	
	public function homeOp(){
		
		$model = Model();
		$slide = $model->table('slide')->order('slide_sort asc')->select();
		Tpl::output('slide',$slide);
		//Tpl::showpage('index');
		Tpl::showpage('zsm/index');
	}
	
	
	public function articleOp(){
		
		$article_id = intval($_GET['article_id']);
		$model = Model();
		
		if($_GET['type']=='tuwen'){
			$tuwen = $model->table('tuwen')->where(array('id'=>$article_id))->find();
			$article = array();
			$article['article_title'] = $tuwen['tuwen_title'];
			$article['article_content'] = $tuwen['tuwen_description'];
		}else{
			$article = $model->table('article')->where(array('id'=>$article_id))->find();
		}
		
		
		if(empty($article)){
			showMessage('操作失败');			
		}
		
		Tpl::output('article',$article);
		Tpl::showpage('article');
	}
}